

//
//  ClickViewController.m
//  xiaowanTravel
//
//  Created by wyzcWLB on 16/10/5.
//  Copyright © 2016年 wyzcWLB. All rights reserved.
//

#import "ClickViewController.h"
#import "slideModel.h"

@interface ClickViewController ()
@property(nonatomic,strong)UIWebView *webView;

@end

@implementation ClickViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    _webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0 , Screen_Width, Screen_Height)];

    [_webView setOpaque:NO];//opaque是不透明的意思
    [_webView setScalesPageToFit:YES];//自动缩放以适应屏幕
    [self.view addSubview:_webView];
    
    [self addLeftBack];
    
    //加载网页的方式
        //把数组传过来
    slideModel *model=self.adArray[_num];
    
    NSURL *url = [NSURL URLWithString:model.url];
    //加载内容
    [self.webView loadRequest:[NSURLRequest requestWithURL:url]];
}

#pragma mark 设置返回按钮
-(void)addLeftBack{
    
    UIButton *back = [[UIButton alloc]initWithFrame:CGRectMake(10, 20, 14, 14)];
    back.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"icon_trip_cancel"]];
    [self.webView addSubview:back];
    [back addTarget:self action:@selector(goToBack) forControlEvents:UIControlEventTouchUpInside];
}
-(void)goToBack{
    //返回
    [self dismissModalViewControllerAnimated:YES];

}

@end
